<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>首页登录</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
body {
	width: 100%;
	height: 100%;
	background-repeat: no-repeat;
	position: absolute;
	z-index: 100;
}

div {
	width: 70%;
	height: 35%;
	font-size: 2.5em;
	color: white;
	margin-left: 15%;
	margin-top: 30%
}

ul {
	list-style: none;
	padding: 0px;
}

ul li a {
	vertical-align: middle;
}

.li_common {
	height: 17%;
	width: 100%;
	border: 1px solid white;
	border-radius: 65px;
	margin-bottom: 7%;
	padding-left: 8%;
}

div ul li input {
	outline: none;
	background: transparent;
	border: none;
	color: white;
}
</style>
<script type="text/javascript" src="./plugins/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="./plugins/jquery.cookie.js"></script>
<script type="text/javascript">
	var uId = '', uPass = '';
	
	window.onload = function loading() {

		if(uId !=''){
		    $('#uId').val($.cookie('name'));
		}
		if(uPass != ''){
		   $('#uPass').val($.cookie('password'));
		}
		
	}
	
	
	
	function LoginClick() {
		//密码验证
		uId = $('#uId').val();
		uPass = $('#uPass').val();
		
		sendPost("LoginCheck");
	}

	function sendPost(searchText) {
		$.ajax({
			type : "post",
			url : "servlet/SearchInfoServlet",
			data : {
				paramName : searchText,
				paramText : uId,
				paramText2 : uPass,
			},
			dataType : "text",
			success : function(data, textStatus) {
                  
				if(data== 'true'){

					$.cookie('name', uId);
					$.cookie('password', uPass);

				    window.location.href = "./Jsp/QsHome.jsp?"
				}else{
				   alert("登录失败,请重试！！！");
				}

			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("请重试！"); //+ textStatus + errorThrown
			}
		});

	}
	

</script>
</head>

<body style="background-image: url(./img/bgImg.png); background-repeat: no-repeat;background-size: 100% 100%;">
	<div>
		<ul>
			<li style="margin-bottom: 7%;text-align: center;font-size: 1.3em"><a>欢迎你</a>
			</li>
			<li class="li_common" style="padding-top: 5%;"><a
				style="position: relative;float: left">账户名：</a> <input
				style="float:left;width: 70%;font-size: 1.1em" placeholder="请输入用户名"
				id="uId">
			</li>
			<li class="li_common" style="padding-top: 5%;"><a
				style="float: left;">密码：</a><input
				style="float:left;width: 70%;font-size: 1.1em;padding-left: 35px;"
				placeholder="请输入密码" id="uPass" type="password">
			</li>
			<li class="li_common"
				style="background-color: #84c1ff;text-align: center;padding-top: 5%; "
				onclick="LoginClick()"><a>登录</a></li>

		</ul>
	</div>
</body>
</html>
<!-- -->